
package com.huaweicloud.haydn.delivercore.agent.factory;

import com.google.common.util.concurrent.ThreadFactoryBuilder;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @since 2022-12-07
 */
public class DatalinkPoolFactory {
    private static final ThreadFactoryBuilder THREAD_FACTORY_BUILDER = new ThreadFactoryBuilder();

    private static final ExecutorService DEFAULT_EXECUTOR_SERVICE =
        new ThreadPoolExecutor(5, 6, 5L, TimeUnit.MILLISECONDS, BlockingQueueEnum.ARRAY.queue(),
            THREAD_FACTORY_BUILDER.build(), RejectExecHandlerEnum.CALLER_RUNS.handler());

    public static ExecutorService defaultExecutorService() {
        return DEFAULT_EXECUTOR_SERVICE;
    }
}
